package com.yunxin.core.infra.common.order.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.concurrent.TimeUnit;

/**
 * @author zero°
 * @since 2023-08-22
 */
@RequiredArgsConstructor
@Getter
public enum OrderLockKey {
    /**
     * 订单分配
     */
    ORDER_USER_APPLY_ALLOCATION("distribution:cord:order:allocation:", Boolean.FALSE, 1L, 30L, TimeUnit.SECONDS),
    ORDER_PUSH_ORDER("order:push:", Boolean.FALSE, 4L, 10L, TimeUnit.SECONDS),
    ORDER_STACK_INIT_KEY("order:product:stackInit:", Boolean.FALSE, 3L, 5L, TimeUnit.SECONDS),
    ORDER_MERCHANT_STACK_INIT_KEY("order:merchant:stackInit:", Boolean.FALSE, 3L, 5L, TimeUnit.SECONDS),
    ORDER_STACK_STACK_KEY("order:product:stack:", Boolean.FALSE, 3L, 5L, TimeUnit.SECONDS),
    QW_USER_STACK_KEY("order:user:product:stack:", Boolean.FALSE, 100L, 3L, TimeUnit.MILLISECONDS),
    QW_BE_USER_STACK_KEY("order:user:be:product:stack:", Boolean.FALSE, 100L, 3L, TimeUnit.MILLISECONDS),// 企业微信用户key
    QW_PRODUCT_STACK_KEY("order:qw:product:stack:", Boolean.FALSE, 5L, 3L, TimeUnit.SECONDS),
    QW_PRODUCT_BE_STACK_KEY("order:qw:be:product:stack:", Boolean.FALSE, 5L, 3L, TimeUnit.SECONDS),
    ;

    private final String prefix;
    private final Boolean usePrefixAsFullKey;
    private final long waitTime;
    private final long releaseTime;
    private final TimeUnit timeUnit;
}
